<template>	<!-- 只能有一个子元素 -->
	<div>
		home
		<ul>
			<li v-for="(city,index) in list" :key="index" @click="naviTo(city)">{{city}}</li>
		</ul>
		接收：
		{{mycityIns}}
		
		<button @click="getData">获取数据</button>
	</div>
</template>
<script>
	export default{
		data(){
			return{
				mycityIns:'',
				list:["北京","上海","广州","深圳"]
			}
		},
		methods:{
			naviTo(v){
				/* this.$router.push('/life'); //push参数是字符串，不传递参数 */
				/* this.$router.push(`/life/${v}`)  //push参数是字符串，带参数 */
				// this.$router.push({path:'/life'})	//push参数是对象，不传递参数
				// this.$router.push({path:'life',query:{myCityKey:v}}) //push参数是对象 ，传递参数 
				// this.$router.push({name:'Life',query:{myCityKey:v}})
				this.$router.push({name:'Life',params:{myCityKey:v}})
			},
			getData(){
				this.axios.get('').then((response) => {
				  console.log(response.data)
				})
			}
		},
		mounted() {
			this.mycityIns=this.$route.params.myCityKeyIns
		}
	}
</script>